﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Northwind.Import.Data;
using Northwind.Objects;

namespace Northwind
{
    /// <summary>
    /// Interaction logic for WindowLogin.xaml
    /// </summary>
    public partial class WindowLogin : Window
    {
        public WindowLogin()
        {
            InitializeComponent();
        }

        private void Button_Login_Click_1(object sender, RoutedEventArgs e)
        {
            using (NorthwindDataContext adapter = new NorthwindDataContext())
            {
                Northwind.Import.Data.Employee Employee = adapter.Employees.FirstOrDefault();
                Northwind.Objects.Employee employee = new Objects.Employee()
                {
                    FirstName = Employee.FirstName,
                    LastName = Employee.LastName
                };

                SharedData.CurrentUser = employee;
            }

            MainWindow mainWindow = new MainWindow();
            mainWindow.Show();

            this.Close();
        }

        private void Button_Cancel_Click_1(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
